#include "VisWidgetBase.h"

VisWidgetBase::VisWidgetBase(QWidget *parent)
{
    m_ActorsMap = new ActorsMapType;

    m_Renderer = RendererPointer::New();
    m_Renderer->SetBackground(0,0,0);

    GetRenderWindow()->AddRenderer(m_Renderer);
    setAutoFillBackground(false);
}

VisWidgetBase::~VisWidgetBase()
{
    delete m_ActorsMap;
}

void
VisWidgetBase::Update()
{
    m_Renderer->Render();

    GetRenderWindow()->GetInteractor()->Initialize();
    GetRenderWindow()->GetInteractor()->HideCursor();
    GetRenderWindow()->Render();
    GetRenderWindow()->GetInteractor()->Start();
    GetRenderWindow()->GetInteractor()->ShowCursor();

    this->update();
}

void
VisWidgetBase::ShowVolume(int index)
{
    if (!(m_ActorsMap->value(index) == NULL))
        m_ActorsMap->value(index)->VisibilityOn();
   // m_Renderer->ResetCamera();

    this->Update();
}

void
VisWidgetBase::HideVolume(int index)
{
    if (!(m_ActorsMap->value(index) == NULL))
        m_ActorsMap->value(index)->VisibilityOff();
   // m_Renderer->ResetCamera();

    this->Update();
}



